﻿using MediatR;
using Product.Domain;
using Product.Infrstructre.Impl;
using Product.Read.API.Applcation.Command;

namespace Product.Read.API.Applcation.CommandHandlers
{
    public class ProductTypeselectInfoCommandHandler : IRequestHandler<ProductTypeselectInfoCommand, List<ProductType>>
    {
        protected readonly IbaseProductRepository ibaseProductRepository;

        public ProductTypeselectInfoCommandHandler(IbaseProductRepository ibaseProductRepository)
        {
            this.ibaseProductRepository = ibaseProductRepository;
        }

        public async Task<List<ProductType>> Handle(ProductTypeselectInfoCommand request, CancellationToken cancellationToken)
        {
            return (await ibaseProductRepository.GetAllAsync()).ToList();
        }
    }
}
